<?php

namespace app\common\model\mysql;

use think\Model;

class CustomerAddress extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'cus_customer_address';

    /**
     * 添加客户地址数据
     * @param $data
     * @return mixed
     * @throws \think\Exception
     */
    public function addNormalCustomerAddress($data){
        $this->save($data);
        return $this->id;
    }

    /**
     * 根据主键id更新数据表中的数据
     * @param $id
     * @param $data
     * @return bool
     */
    public function updateByCustomerAddressId($id,$data){
        $id = intval($id);
        if(empty($id) || empty($data) || !is_array($data)){
            return false;
        }
        $where = [
            "customer_address_id"=>$id,
        ];
        return $this->where($where)->save($data);
    }
}
